﻿#pragma once
#include <QWidget>
#include <QTextEdit>

#include "Node_Serializable.h"

class Node;
class QDMNodeContentWidget:public QWidget, public Serializable
{
public:
    QDMNodeContentWidget(std::weak_ptr<Node>node, QWidget* parent = nullptr);
    ~QDMNodeContentWidget();
    void setEditingFlag(bool flag);

    const rapidjson::Document serialize() override;
    void deserialize(const rapidjson::Value& value) override;

protected:
    void initUI();
private:
    //【20240114】【class16】这两个变量暂时没用，只是为了删除QTextEdit的保护，后续看情况
    bool m_editingFlag = false;
    std::weak_ptr<Node> m_node;
};

class QDMTextEdit :public QTextEdit
{
public:
    QDMTextEdit(const QString& text, QWidget* parent = nullptr);
protected:
    void keyPressEvent(QKeyEvent* e) override;
    void focusInEvent(QFocusEvent* e) override;
    void focusOutEvent(QFocusEvent* e) override;
private:

};